class Solution {
    public int maxArea(int[] height) {
        int left = 0,right = height.length-1;
        int v = 0;
        while(left < right) {
            int v1 = 0;
            if(height[left] < height[right]) {
                v1 = height[left]*(right - left);
                left++;
            }else {
                v1 = height[right]*(right - left);
                right--;
            }
            if(v < v1) {
                v = v1;
            }
        }
        return v;
    }
}